package com.analysis.model;

import java.io.Serializable;
import java.sql.Date;

public class KLine implements Serializable {
    private static final long serialVersionUID = -284854436264435752L;
    private String symbol;	// 股票代码
    private String name;
	private Date day;		// 日期
	private double open;	// 开盘价
	private double close;	// 收盘价
	private double high;	// 最高价
	private double low;		// 最低价
	private long volume;	// 成交量


	public KLine() {
		super();
	}

	public KLine(String symbol, Date day, double open, double close,
			double high, double low, long volume) {
		super();
		this.symbol = symbol;
		this.day = day;
		this.open = open;
		this.close = close;
		this.high = high;
		this.low = low;
		this.volume = volume;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public KLine(String symbol){
	    super();
	    this.symbol = symbol;
	}

	public String getSymbol() {
		return symbol;
	}

	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}

	public Date getDay() {
		return day;
	}

	public void setDay(Date day) {
		this.day = day;
	}

	public double getOpen() {
		return open;
	}

	public void setOpen(double open) {
		this.open = open;
	}

	public double getClose() {
		return close;
	}

	public void setClose(double close) {
		this.close = close;
	}

	public double getHigh() {
		return high;
	}

	public void setHigh(double high) {
		this.high = high;
	}

	public double getLow() {
		return low;
	}

	public void setLow(double low) {
		this.low = low;
	}

	public long getVolume() {
		return volume;
	}

	public void setVolume(long volume) {
		this.volume = volume;
	}
	/**根据日期比较KLine大小
	 * @param
	 * @param
	 * @param
	 * @author  陈集彬
	 * @return  int
	 * @date    2016年9月11日
	 */
	public int compareTo(KLine kline){
		if(this==null||this.getDay()==null
				||kline==null||kline.getDay()==null) {
            throw new NullPointerException();
        }

		if(this==kline) {
            return 0;
        }

		Date ower=this.getDay();
		Date com=kline.getDay();

		return ower.compareTo(com);
	}
	public boolean isEmpty() {
		return this==null||day==null;
	}
}